<%@ include file="/WEB-INF/tiles/include.jsp"%>

<script type="text/javascript">
	
	$(document).ready(function($) {
		$("#facebox_new").click(function() {
			$.wis.util.doViewForm();
		});
	
		$("#modalbox_del").click(function(id) {
			$.modalbox.showConfirm('<spring:message code="confirm.areYouSure"/>',$("#selectedRecord"), function(){$.wis.util.doDel($("#selectedRecord"))});   
		});
	
		$(".facebox_edit").click(function(){
			var idEdit = $(this).attr("title");
			//alert("ID :: "+idEdit);
			$.wis.util.doEdit(idEdit);
		});
		
		$(".modalbox_singleDel").click(function(){
			var idEdit = $(this).attr("title");
			//alert("ID :: "+idEdit);
			$.modalbox.showConfirm('<spring:message code="confirm.areYouSure"/>',idEdit, function(){$.wis.util.doDel(idEdit)});
		});
	
		$("table.cTag>thead>tr>th>a").each(function(){
			$(this).attr("class","ahrefDT");
		});
		$("table.cTag>thead>tr>th").find(".ahrefDT").each(function(){
			$(this).click(function() {
				linkData = $(this).attr("href");
				qryStrDT = linkData.split("?",2)[1];
				qryStrDT = qryStrDT.split("#index",1);
				$.wis.util.doSortDisplayTag(""+qryStrDT);
				return false;
			});
		});
		
	});
</script>

<a name="index"/>
<form:form id="mainForm" commandName="commandUser" method="post" action="${pageContext.request.contextPath}/basic/admin/user">
	<form:hidden path="pgIndex"/>
	<form:hidden path="pgRows"/>
	<form:hidden path="pgTotal"/>

<fieldset class="fieldset">
<table class="navigator">
<tr>
	<td align="left">
		<span class="button"><a href="#modalbox" id="modalbox_del"><spring:message code="label.delete"/></a></span>&nbsp;
		<span class="button"><a href="#facebox" id="facebox_new" >&nbsp;<spring:message code="label.add"/>&nbsp;</a></span>&nbsp;
	</td>
	<td align="right"><div id="pageNavigator"></div></td>
</tr>
</table>
<c:if test="${not empty commandUser.data}">
<display:table id="row" class="cTag" name="commandUser.data" requestURI="#index">
	<display:column title="<input type=\"checkbox\" id=\"selectAllId\" onclick=\"$.wis.util.doCheck()\">" style="width: 15px; align: center;">
		<center><input type="checkbox" name="selectedRecord" value="${row.id}"></center>
	</display:column>
		<display:column titleKey="label.userId" property="username"
			sortable="true" />
	<display:column titleKey="label.roleId" sortable="true">
		<c:forEach items="${commandUser.roleCB}" var="role" varStatus="roleSt">
			<c:if test="${row.roleId == role.stValue}">
				<center>${role.stLabel}</center>
			</c:if>
		</c:forEach>
	</display:column>
	<display:column titleKey="label.loc" sortable="true">
		<c:forEach items="${commandUser.locCB}" var="loc" varStatus="locSt">
			<c:if test="${row.locId == loc.stValue}">
				<center>${loc.stLabel}</center>
			</c:if>
		</c:forEach>
	</display:column>
	<display:column titleKey="label.passwordstatus" sortable="true" >
		<c:if test="${not empty row.locktimestamp}"><center>Locked</center></c:if>
		<c:if test="${empty row.locktimestamp}"><center>Not Locked</center></c:if>
	</display:column>
	<display:column titleKey="label.createBy" property="createdby"
		sortable="true" />
	<display:column titleKey="label.createDt" property="createddate"
		sortable="true" />
	<display:column titleKey="label.changedBy" property="changedby"
		sortable="true" />
	<display:column titleKey="label.changedDt" property="changeddate"
		sortable="true" />
	<display:column title="Action">
	<a title="${row.id}" href="#facebox_edit" class="facebox_edit"><spring:message code="label.edit"/></a>&nbsp;
	<a title="${row.id}" href="#modalbox_singleDel" class="modalbox_singleDel"><spring:message code="label.delete"/></a>
</display:column>
</display:table>
</c:if>
</fieldset>

</form:form>
